package com.uft.model.entity;

import static javax.persistence.CascadeType.ALL;
import static javax.persistence.CascadeType.REMOVE;

import java.io.Serializable;
import java.lang.Integer;
import java.lang.String;

import javax.persistence.*;



/**
 * Entity implementation class for Entity: Server
 *
 */
@Entity

@NamedQueries({
	@NamedQuery(
	name = "getServerByName",
	query = "SELECT s FROM Server s WHERE s.serverName=:serverName"
	),
	@NamedQuery(
	name = "getServerByNode",
	query = "SELECT s FROM Server s WHERE s.nodeName=:nodeName"
	),
	@NamedQuery(
	name = "getServerByHost",
	query = "SELECT s FROM Server s WHERE s.serverHostname=:serverHostname"
	),
	@NamedQuery(
	name = "getServerByNameNodeHost",
	query = "SELECT s FROM Server s WHERE s.serverName=:serverName AND s.nodeName=:nodeName AND s.serverHostname=:serverHostname"
	),
	@NamedQuery(
	name = "searchServerByServerName",
	query = "SELECT DISTINCT s.serverName FROM Server s WHERE s.serverName LIKE  :sString"
	),
	@NamedQuery(
	name = "searchServerByNodeName",
	query = "SELECT DISTINCT s.nodeName FROM Server s WHERE s.nodeName LIKE  :sString"
	),
	@NamedQuery(
	name = "searchServerByServerHostname",
	query = "SELECT DISTINCT s.serverHostname FROM Server s WHERE s.serverHostname LIKE  :sString"
	)
	
	
})
public class Server implements Serializable {

	   
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer serverId;
	private String serverName;
	private String serverHostname;
	private String nodeName;
	private String nodeHostname;
	
	@OneToOne (cascade=CascadeType.ALL)
	@JoinColumn(name="SERVER_RUNTIME_ID", unique= true, nullable=true, insertable=true, updatable=true)
	private ServerRuntime serverRuntime;
	
	@OneToOne (cascade=CascadeType.ALL)
	@JoinColumn(name="SERVER_SETTING_ID", unique= true, nullable=true, insertable=true, updatable=true)
	private ServerSettings serverSettings;
	
	private static final long serialVersionUID = 1L;

	public Server() {
		super();
	}   
	public Integer getServerId() {
		return this.serverId;
	}

	public void setServerId(Integer serverId) {
		this.serverId = serverId;
	}   
	public String getServerName() {
		return this.serverName;
	}

	public void setServerName(String serverName) {
		this.serverName = serverName;
	}   
	public String getServerHostname() {
		return this.serverHostname;
	}

	public void setServerHostname(String serverHostname) {
		this.serverHostname = serverHostname;
	}   
	public String getNodeName() {
		return this.nodeName;
	}

	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}   
	public String getNodeHostname() {
		return this.nodeHostname;
	}

	public void setNodeHostname(String nodeHostname) {
		this.nodeHostname = nodeHostname;
	}
	public ServerRuntime getServerRuntime() {
		
		return serverRuntime;
	}
	public void setServerRuntime(ServerRuntime serverRuntime) {
		this.serverRuntime = serverRuntime;
	}
	public ServerSettings getServerSettings() {
	
		return serverSettings;
	}
	public void setServerSettings(ServerSettings serverSettings) {
		this.serverSettings = serverSettings;
	}
   
}
